using UnityEngine;
using System.Collections;

public class SceneManager : MonoBehaviour
{
    public string cenaAtual;
	
	public static bool PlayerDead = false;
	
	public void Start ()
    {
        this.cenaAtual = Application.loadedLevelName;
	}
	
	
	
	public void Update ()
    {
		if (this.cenaAtual == "Menu")
        {
            if (Input.GetKeyUp(KeyCode.Space))
			{
				//this.TrocarCena();				
            }
        }
		
        if (this.cenaAtual != "Game" && this.cenaAtual != "Menu")
        {
            if (Input.GetKeyUp(KeyCode.Escape))
            {
                this.TrocarCena();				
            }
        }
		
		if (this.cenaAtual == "Game")			
		{
			if (Input.GetKeyUp(KeyCode.J))
			{
				this.TrocarCena();				
            }
			if(PlayerDead)
			{
				this.TrocarCena();	
			}
		}

        //Debug.Log(cenaAtual);
	}

    public void TrocarCena()
    {
		
        switch (this.cenaAtual)
        {
            case "Menu": Application.LoadLevel("Periodo");
			PlayerDead = false;
			Pontos.Pontuacao = 0;
			TimeCounter.Hora = 0;
			TimeCounter.Minutos = 0;
			TimeCounter.Dia = 0;
            break;

            case "Game": Application.LoadLevel("End");
            break;

            case "End": Application.LoadLevel("Menu");
            break;
        }
		

		//Debug.Log(cenaAtual);
    }
	

}